package Test_1;

import java.util.Scanner;

public class Class2 {
    public static void main(String[] args) {
        Class p=new Class();
        p.name="java75班";
        p.teacher="老刘";
        p.date="2021.8.2";
        Scanner in=new Scanner(System.in);
        while (true){
            System.out.println("添加学生，请按1");
            System.out.println("获得班级人数请按2");
            System.out.println("查看班级信息请按3");
            System.out.println("查找学生位置请按4");
            System.out.println("查找学生，请按5");
            System.out.println("退出请按9");
            System.out.println("请选择要进行的操作");
            switch (in.nextInt()){
                case 1:
                    System.out.println("请输入学生姓名");
                    p.add(in.next());
                    System.out.println("添加学生成功");
                    break;
                case 2:
                    System.out.println(p.classSize());
                    break;
                case 3:
                    p.show();
                    break;
                case 4:
                    System.out.println("请输入学生序号");
                    String a=p.seek(in.nextInt());
                    System.out.println("学生的位置是"+a);
                    break;
                case 5:
                    System.out.println("请输入查找学生的姓名");
                    String name=in.next();
                    boolean b=p.seek(name);
                    if (b==true){
                        System.out.println(name+"在班级里");
                    }else{
                        System.out.println(name+"不在班级里");
                        break;
                    }
                case 9:
                    return;
            }
        }
    }
}